const multer = require('@koa/multer')

// const loadAvatar = multer({
//     dest: './uploads'
// })

const uploadAvatar  = multer({
    storage: multer.diskStorage({
        destination(req, file, callback) {
            callback(null, "./uploads");
        },
        filename(req, file, callback) {
            callback(null, Date.now() + "_" + file.originalname);
        },
    }),
})

const uploadImage = uploadAvatar.single('avatar')

module.exports = uploadImage